﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE HTML>
<html>
<head>
<%@include file="/WEB-INF/pages/header.jsp" %>
<title>作品分类信息</title>

    <script>

        function ajaxDelete(url,param) {
            var bool = window.confirm("是否真的删除");
            if (bool) {
                $.post(url,param,function (ajaxResult) {
                    alert(ajaxResult.msg)
                    if (ajaxResult.code == 200) {
                        location.reload();
                    } else {
                        alert(ajaxResult.msg)
                    }

                },'json')


            }

        }



    </script>
</head>
<body>
    
<div class="pd-20">

    <form action="<%=ctxPath%>/types/listPage">
        <input type="hidden" id="curr" name="curr" />
        <input type="hidden" id="size" name="size" value="3" />

        <div class="text-c">
            添加日期：
    		<input type="text" onclick="WdatePicker()" name="beginTime" value="${param.beginTime }" class="input-text Wdate" style="width:120px;" />
    		-
    		<input type="text" onclick="WdatePicker()" name="endTime" value="${param.endTime }" class="input-text Wdate" style="width:120px;" />
    		分类名称:<input type="text" name="name" value="${param.name }" placeholder=" 分类名称(模糊查询) " style="width:200px" class="input-text" />
    		
    		分类简介:<input type="text" name="intro" value="${param.intro }" placeholder=" 简介(模糊查询) " style="width:200px" class="input-text" />
    		<button class="btn btn-success" type="submit">查找</button>
    		<button class="btn btn-primary" onclick="clearInput();" type="button">重置</button>
    		
    	</div>
	</form>
	
	<div class="mt-20">
    <table class="table table-border table-bordered table-bg table-hover" >
        <thead>
            <tr>
                <th>分类ID号</th>
                <th>分类名称</th>
                <th>简介</th>
                <th>创建时间</th>
                <th>修改时间</th>
                <th>操作人</th>
                <th>操作 <button class="btn size-MINI btn-success radius" onclick="showLayer('添加管理员','<%=ctxPath%>/types/addPage')"> 添  加</button></th>
            	
            </tr>
        </thead>
        <tbody>
            <c:forEach items="${typesList }" var="types">
                <tr>                    
                    <td>${types.id }</td>
                    <td>${types.name }</td>
                    <td>${types.intro }</td>
                    <td><fmt:formatDate value="${types.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <td><fmt:formatDate value="${types.updateTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>

                    <td>${types.operator }</td>

                    
                    <td>
                        <button class="btn size-MINI btn-danger radius" onclick="ajaxDelete('<%=ctxPath%>/types/delete','id=${types.id }')">删除</button>
                        <button class="btn size-MINI btn-secondary radius" onclick="showLayer('修改信息','<%=ctxPath%>/types/updatePage?id=${types.id }')">修改</button>

                    </td>
                </tr>
            </c:forEach>
        </tbody>
    </table>
    
    		<c:if test="${pageInfo.pages>1 }">
			<div id="pagination" style="margin: 20px;"></div>
			<script type="text/javascript"
				src="<%=ctxPath %>/lib/laypage/1.2/laypage.js"></script>
			<script type="text/javascript">
                laypage({
                	cont:'pagination',
                    pages:'${pageInfo.pages}', //总数多少页
                    curr: '${pageInfo.curr}', // 当前是第几页
                    skip: true, //是否开启跳页
                    skin: '#ADADAD',
                    jump:function(obj,first){
                        if(!first){
                            $("#curr").val(obj.curr);
                            $("#size").val(obj.size);
                           // 把curr和size往后台发送
                            $("form").submit();
                        }
                    }
                });
            </script>
		</c:if>
    
</div>
</div>
</body>
</html>